@extends('layout.index')
@section('title','用户地址列表')
@section('content')
	<div class="mws-panel grid_8">
    <div class="mws-panel-header">
      <span>用户地址列表</span>
    </div>

    <div class="mws-panel-body no-padding">
      <div role="grid" class="dataTables_wrapper" id="DataTables_Table_1_wrapper">
      	<form action="/admin/address/index" method='get'>
	        <div id="DataTables_Table_1_length" class="dataTables_length">
	          <label>显示 <select name="num" size="1" aria-controls="DataTables_Table_1">
	            <option value="10" @if(!empty($request['num']) && $request['num'] == 10)
								   	selected
								   @endif
	            >
	              10
	            </option>

	            <option value="25" @if(!empty($request['num']) && $request['num'] == 25)
								   	selected
								   @endif>
	              25
	            </option>

	            <option value="50" @if(!empty($request['num']) && $request['num'] == 50)
								   	selected
								   @endif>
	              50
	            </option>

	            <option value="100" @if(!empty($request['num']) && $request['num'] == 100)
								   	selected
								   @endif>
	              100
	            </option>
	          </select> 条</label>
	        </div>
		
	        <div class="dataTables_filter" id="DataTables_Table_1_filter">
	          <label>关键字: <input type="text" value="{{$request['keywords'] or ''}}" name='keywords' aria-controls="DataTables_Table_1" />
							 <button class='btn btn_default'>搜索</button>
	          </label>
	        </div>
		</form>
        <table class="mws-datatable-fn mws-table dataTable" id="DataTables_Table_1" aria-describedby="DataTables_Table_1_info">
          <thead>
            <tr role="row">
              <th class="sorting_asc" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 156px;" aria-sort="ascending" aria-label="Rendering engine: activate to sort column descending">ID</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 212px;" aria-label="Browser: activate to sort column ascending">用户名</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 212px;" aria-label="Browser: activate to sort column ascending">收件人</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 197px;" aria-label="Platform(s): activate to sort column ascending">地址</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 197px;" aria-label="Platform(s): activate to sort column ascending">联系方式</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 197px;" aria-label="Platform(s): activate to sort column ascending">邮编</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 197px;" aria-label="Platform(s): activate to sort column ascending">地址默认状态</th>

              <th class="sorting" role="columnheader" tabindex="0" aria-controls="DataTables_Table_1" rowspan="1" colspan="1" style="width: 97px;" aria-label="CSS grade: activate to sort column ascending">操作</th>
            </tr>
          </thead>

          <tbody role="alert" aria-live="polite" aria-relevant="all">
          @foreach($address as $k=>$v)
            <tr class="@if($k%2 == 0)
						even
					    @else
					     odd
					   @endif
            ">
              <td class=" sorting_1">{{$v->id}}</td>

              <td class="">{{$v->username}}</td>

              <td class="">{{$v->getman}}</td>

              <td class="">{{$v->address}}</td>

              <td class="">{{$v->phone}}</td>

              <td class="">{{$v->mailcode}}</td>

              <td class="">@if($v->status == 0)
                            默认地址
                           @endif
                           @if($v->status == 1)
                            不是默认地址
                           @endif
              </td>
              <td class="">
				        <a href="/admin/address/edit/{{$v->id}}" id='yanse'><i class="icon-wrench"></i>修改</a>
              </td>
            </tr>
            @endforeach
          </tbody>
        </table>

        <div class="dataTables_info" id="DataTables_Table_1_info">
          
        </div>

        <div class="dataTables_paginate paging_full_numbers" id="pages">
          {!! $address->appends($request)->render() !!}
        </div>
      </div>
    </div>
  </div>
@endsection